use ATE
go



IF OBJECT_ID ( 'AllocateFYGESN_Insert', 'P' ) IS NOT NULL 
    DROP PROCEDURE AllocateFYGESN_Insert;
GO
CREATE PROCEDURE AllocateFYGESN_Insert
    @PackageProductSN nvarchar(50),
	@RecordTime datetime, 
    @HoldoverValue decimal(6,2),
	@UserID nvarchar(10)
AS    	
	insert into AllocateFYGESN(PackageProductSN,HoldoverValue,RecordTime,UserID)
	Values(@PackageProductSN,@HoldoverValue,@RecordTime,@UserID);
GO 



IF OBJECT_ID ( 'AllocateFYGESN_selectbySN', 'P' ) IS NOT NULL 
    DROP PROCEDURE AllocateFYGESN_selectbySN;
GO
CREATE PROCEDURE AllocateFYGESN_selectbySN
    @PackageProductSN nvarchar(50)
AS    
    select PackageProductSN,RecordTime,HoldoverValue,UserID  
    from AllocateFYGESN 
    where PackageProductSN=@PackageProductSN 
GO



IF OBJECT_ID ( 'AllocateFYGESN_selectbyDT', 'P' ) IS NOT NULL 
    DROP PROCEDURE AllocateFYGESN_selectbyDT;
GO
CREATE PROCEDURE AllocateFYGESN_selectbyDT
    @starttime datetime,
    @stoptime datetime
AS    
    select PackageProductSN,RecordTime,HoldoverValue,UserID  
    from AllocateFYGESN 
    where RecordTime between @starttime and @stoptime  
    order by RecordTime desc 
GO























